package com.cloudspace.jindun.activity.xiaoxi;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.cloudspace.jindun.R;
import com.cloudspace.jindun.activity.CustomTitleBaseActivity;
import com.cloudspace.jindun.utils.ToastMaker;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TopicActivity extends CustomTitleBaseActivity {

    @Bind(R.id.topic_iv_back)
    ImageView mTopicIvBack;
    @Bind(R.id.group_et_title)
    EditText mGroupEtTitle;
    @Bind(R.id.group_btn_next)
    Button mGroupBtnNext;
    @Bind(R.id.rl_text_title)
    TextView mRlTextTitle;

    private String huatiName = null;
    private int isbut=1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.xiaoxi_huati_initiate, false);
        ButterKnife.bind(this);
         isbut = getIntent().getIntExtra("isbut", 1);
        if (isbut == 2) {
            mRlTextTitle.setText(getResources().getString(R.string.create_groupchat));
        }
    }

    @OnClick({R.id.topic_iv_back, R.id.group_btn_next})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.topic_iv_back:
                finish();
                break;
            case R.id.group_btn_next:
                if (mGroupEtTitle.getText().toString() != null) {
                    huatiName = mGroupEtTitle.getText().toString();
                    Intent intent = new Intent();
                    intent.setClass(TopicActivity.this, TopicLXRActivity.class);
                    intent.putExtra("title", huatiName);
                    intent.putExtra("isbut",isbut);
                    startActivity(intent);
                    finish();
                } else {
                    ToastMaker.showToastShort(R.string.input_title);
                }

                break;
        }
    }

}
